/**
 * @Project Name:hoofungson-elk-log
 * @Package Name:cn.hoofungson.framework.elk.log.converter.pattern
 * @Since JDK 1.8
 */

package cn.hoofungson.framework.elk.log.converter.pattern;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import cn.hoofungson.framework.elk.log.util.ProcessUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * @Description: ProcessIdPatternConverter
 * @Author 胡松 hoofungson@163.com
 * @Date 2020-03-07 18:28
 * @Version V1.0
 */
public class ProcessIdPatternConverter extends ClassicConverter {

    @Override
    public String convert(ILoggingEvent iLoggingEvent) {
        return null != ProcessUtils.getPid() ? ProcessUtils.getPid() : StringUtils.EMPTY;
    }
}
